package Gui;

import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;

public class DefinitionOfClass extends JPanel {
public Secretry main_frame;
	
	private final ButtonGroup buttonGroup = new ButtonGroup();
	public JPanel Open_new_course;
	int selection=0;
	public JPanel tal;
	public DefinitionOfClass(Secretry a)
	{
		setLayout(null);
		main_frame=a;
		tal=this;
		JRadioButton rdbtnNewRadioButton_1 = new JRadioButton("Update Class");
		rdbtnNewRadioButton_1.setBounds(23, 98, 207, 23);
		add(rdbtnNewRadioButton_1);
		rdbtnNewRadioButton_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				selection=2;
			}
		});
		buttonGroup.add(rdbtnNewRadioButton_1);
		
		JRadioButton rdbtnNewRadioButton_2 = new JRadioButton("Add Students To Class");
		rdbtnNewRadioButton_2.setBounds(23, 135, 246, 23);
		add(rdbtnNewRadioButton_2);
		rdbtnNewRadioButton_2.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				selection=3;
			}
		});
		buttonGroup.add(rdbtnNewRadioButton_2);
		
		JLabel lblDefinisionOfCourse = new JLabel("Definition Of Class");
		lblDefinisionOfCourse.setBounds(142, 11, 145, 23);
		add(lblDefinisionOfCourse);
		lblDefinisionOfCourse.setFont(new Font("Tahoma", Font.PLAIN, 16));
		
		JButton Next1Window = new JButton("Next");
		Next1Window.setBounds(333, 244, 89, 23);
		add(Next1Window);
		
		
		Next1Window.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e) 
			{
				
				if(selection==0){
						
					showMsg("You need to enter your choice. Pleas try again");
				}
				if(selection==1){

					main_frame.update_panel(6, 7);
					
				}
				if(selection==2){

					main_frame.update_panel(6, 8);
					
				}
				if(selection==3){

				//main_frame.update_panel(2, 5);
					
				}
				if(selection==4){

					//main_frame.update_panel(2, 5);	
					}
			}
		});
		
		JButton Back1Window = new JButton("Back");
		Back1Window.setBounds(234, 244, 89, 23);
		add(Back1Window);

		JRadioButton rdbtnNewRadioButton = new JRadioButton("Create Class");
		rdbtnNewRadioButton.setBounds(23, 58, 207, 23);
		add(rdbtnNewRadioButton);
		rdbtnNewRadioButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				selection=1;
			}
		});
		buttonGroup.add(rdbtnNewRadioButton);
		
		JRadioButton rdbtnRemoveStudentFrom = new JRadioButton("Remove Student From Course");
		rdbtnRemoveStudentFrom.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				selection=4;
			}
		});
		rdbtnRemoveStudentFrom.setBounds(25, 173, 205, 23);
		buttonGroup.add(rdbtnRemoveStudentFrom);
		add(rdbtnRemoveStudentFrom);
		
		
		Back1Window.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e) 
			{
					
				main_frame.update_panel(6,1);		
			}
		});


	}
	
	
	public void showMsg(String msg)
	{
		JOptionPane.showMessageDialog(null,msg,"Login Eror",JOptionPane.ERROR_MESSAGE);
	}
}
